#pragma once;

#define DIRECTINPUT_VERSION 0x0800
#include <dinput.h>
#include "DXUT.h"

#define ReleaseCOM(x) { if(x){ x->Release();x = 0; } }

class DirectInput
{
public:
	DirectInput() {}
	void onCreateDevice(IDirect3DDevice9 *pd3dDevice);
	void onDestoryDevice();

	void poll();
	bool keyDown(char key);
	bool mouseButtonDown(int button);
	float mouseDX();
	float mouseDY();
	float mouseDZ();

private:
	// Make private to prevent copying of members of this class.
	DirectInput(const DirectInput& rhs);
	DirectInput& operator=(const DirectInput& rhs);
		
private:
	IDirectInput8*       mDInput;

	IDirectInputDevice8* mKeyboard;
	char                 mKeyboardState[256]; 

	IDirectInputDevice8* mMouse;
	DIMOUSESTATE2        mMouseState;
};
extern DirectInput* g_input;